﻿using System;
using System.Web.Routing;


namespace CuoiHoi
{
    public class Global : System.Web.HttpApplication
    {
        void ResgisterRoutes(RouteCollection routes)
        {
            routes.MapPageRoute("Home", "", "~/Default.aspx");
            routes.MapPageRoute("Error", "error", "~/404.aspx");
            routes.MapPageRoute("DanhMuc", "{TitleDanhMuc}-cat{IdDanhMuc}", "~/DanhMuc.aspx", false, null,
                new RouteValueDictionary { { "IdDanhMuc", "[0-9]*" } });
            routes.MapPageRoute("ThongTin", "{TitleThongTin}-info{IdInfo}", "~/DanhMuc.aspx", false, null,
                new RouteValueDictionary { { "IdDanhMuc", "[0-9]*" } });
            routes.MapPageRoute("Media", "{TitleMedia}-media{IdMedia}", "~/DanhMuc.aspx");

            routes.MapPageRoute("ChiTietMedia", "{TitleMedia}-media{IdMedia}/{IdItemMedia}", "~/DanhMuc.aspx", false, null,
                new RouteValueDictionary { { "IdMedia", "[0-9]*" }, { "IdItemMedia", "[0-9]*" } });

            routes.MapPageRoute("ChiTietDanhMuc", "{TitleDanhMuc}-cat{IdDanhMuc}/{Title}-{Id}", "~/DanhMuc.aspx", false, null,
                new RouteValueDictionary { { "Id", "[0-9]*" }, { "IdDanhMuc", "[0-9]*" } });            
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            ResgisterRoutes(RouteTable.Routes);
        }

        protected void Session_Start(object sender, EventArgs e)
        {

        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {
            
        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}